package com.harry.demo9;

import org.springframework.cache.annotation.CacheConfig;
import org.springframework.cache.annotation.CacheEvict;
import org.springframework.cache.annotation.CachePut;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;

import javax.transaction.Transactional;

/**
 * @author Harry
 * @date 2018/3/21 10:52
 */
@CacheConfig(cacheNames = "users")
@Transactional
public interface UserRepository extends JpaRepository<User, Long> {

	@Cacheable(key = "'demoInfo_'+#User.getId()")
	User findByName(String name);

}
